//package com.zoweunion.mechanic.plugins.jms;
//
//import javax.jms.ConnectionFactory;
//import javax.jms.Queue;
//import javax.jms.Topic;
//import org.apache.activemq.ActiveMQConnectionFactory;
//import org.apache.activemq.command.ActiveMQQueue;
//import org.apache.activemq.command.ActiveMQTopic;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.jms.annotation.EnableJms;
//import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
//import org.springframework.jms.config.JmsListenerContainerFactory;
//import org.springframework.jms.core.JmsTemplate;
//
//@Configuration
//@EnableJms
//public class JmsConfig {
//
//	public final static String TOPIC = "mechanic.topic";
//	public final static String QUEUE = "mechanic.queue";
//
//	@Bean("queue")
//	public Queue queue() {
//		return new ActiveMQQueue(QUEUE);
//	}
//
//	@Bean("topic")
//	public Topic topic() {
//		return new ActiveMQTopic(TOPIC);
//	}
//
//	/**
//	 * topic模式的ListenerContainer
//	 * @param activeMQConnectionFactory
//	 * @return
//	 */
//	@Bean("jmsListenerContainerTopic")
//	public JmsListenerContainerFactory<?> jmsListenerContainerTopic(@Qualifier("activeMQConnectionFactory")ConnectionFactory activeMQConnectionFactory) {
//		DefaultJmsListenerContainerFactory bean = new DefaultJmsListenerContainerFactory();
//		bean.setPubSubDomain(true);
//		bean.setConnectionFactory(activeMQConnectionFactory);
//		return bean;
//	}
//
//	/**
//	 * queue模式的ListenerContainer
//	 * @param activeMQConnectionFactory
//	 * @return
//	 */
//	@Bean("jmsListenerContainerQueue")
//	public JmsListenerContainerFactory<?> jmsListenerContainerQueue(@Qualifier("activeMQConnectionFactory")ConnectionFactory activeMQConnectionFactory) {
//		DefaultJmsListenerContainerFactory bean = new DefaultJmsListenerContainerFactory();
//		bean.setConnectionFactory(activeMQConnectionFactory);
//		return bean;
//	}
//
//	@Bean("activeMQConnectionFactory")
//	public ConnectionFactory connectionFactory(){
//		return new ActiveMQConnectionFactory();
//	}
//
//	@Bean("jmsTemplate")
//	public JmsTemplate jmsTemplate(@Qualifier("activeMQConnectionFactory")ConnectionFactory connectionFactory) {
//		JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory);
//		jmsTemplate.setPriority(999);
//		return jmsTemplate;
//
//	}
//
//}
